/**
 * 本项目采用《JFinal 俱乐部授权协议》，保护知识产权，就是在保护我们自己身处的行业。
 * 
 * Copyright (c) 2011-2021, jfinal.com
 */

package com.l2qq.admin.permission;

import com.jfinal.aop.Inject;
import com.jfinal.core.Controller;
import com.jfinal.core.Path;
import com.jfinal.kit.Ret;
import com.l2qq.common.model.Permission;

/**
 * 权限管理
 */
@PermissionGroup("权限管理")
@Path("/admin/permission")
public class PermissionAdminController extends Controller {

	@Inject
	PermissionAdminService srv;

    /**
     * 增强版权限同步
     */
    @PermissionAuth(value = "同步权限", key = "permission:sync",remark = "同步更新所有权限接口")
    //@PermissionDependency({"system:manage", "log:view", "user:read"})
    public void syncEnhanced() {
        Ret ret = srv.syncEnhanced();
        renderJson(ret);
    }

	
    public void syncVue() {
        Ret ret = srv.sync();
        renderJson(ret);
    }


  public void editVue() {
        keepPara("pn");	// 保持住分页的页号，便于在 ajax 提交后跳转到当前数据所在的页
        Permission permission = srv.findById(getInt("id"));
        set("permission", permission);
        renderJson();
    }
	


    public void updateVue() {
        Ret ret = srv.update(getBean(Permission.class,""));
        renderJson(ret);
    }



    public void deleteVue() {
        Ret ret = srv.delete(getInt("id"));
        renderJson(ret);
    }
}




